import { _decorator, Node, Vec2 } from 'cc';
import { ColorBlock_GameStorage } from './ColorBlock_GameStorage';
import ColorBlock_Block from '../Game/ColorBlock_Block';

export class ColorBlock_GameData {
    static item_score: number = 10;

    static arrBlocks: ColorBlock_Block[] = [];
    static pause: boolean = true;
    static score: number = 0;

    static colors = [
        // 第一阶段：高区分度基础色
        "#E91E63", // 粉红 (与亮红相近)
        "#2196F3", // 亮蓝
        "#08AA00", // 绿色
        "#FFEB3B", // 亮黄
        "#ACC363", // 酸橙(绿)
        "#673AB7", // 深紫

        // "#FDF6E3", // 香草白 - 略带蜂蜜色调，温暖而明亮，带来阳光感
        // "#795548", // 棕色
        // "#3F51B5", // 靛蓝
        // "#F44336", // 亮红

        // "#29E7D6", // 青绿蓝
        // "#E1BEE7", // 浅紫
        // "#BDBDBD", // 中灰
        // "#FFB74D", // 橙黄 (与琥珀黄相近)
    ];

    static InitData() {
        ColorBlock_GameData.arrBlocks = [];
        ColorBlock_GameData.score = 0;
    }

    static UpdateScore() {
        if (ColorBlock_GameData.Get_score() > ColorBlock_GameStorage.data.mode_1.high_score) {
            ColorBlock_GameStorage.data.mode_1.high_score = ColorBlock_GameData.Get_score();

            ColorBlock_GameStorage.saveData();
        }
    }
    static Get_score() {
        return ColorBlock_GameData.score;
        // return ColorBlock_GameStorage.data.mode_1.score;
    }
    static Set_score(value) {
        ColorBlock_GameData.score = value;
        // ColorBlock_GameStorage.data.mode_1.score = value;
        // ColorBlock_GameStorage.saveData();
    }
    static Add_score(value) {
        ColorBlock_GameData.Set_score(ColorBlock_GameData.Get_score() + value);

        if (ColorBlock_GameData.Get_high_score() < ColorBlock_GameData.Get_score()) {
            ColorBlock_GameData.Set_high_score(ColorBlock_GameData.Get_score());
        }
    }

    static Get_high_score() {
        return ColorBlock_GameStorage.data.mode_1.high_score;
    }
    static Set_high_score(value) {
        ColorBlock_GameStorage.data.mode_1.high_score = value;
        ColorBlock_GameStorage.saveData();
    }

    static ClearData() {
    }
}

window["ColorBlock_GameData"] = ColorBlock_GameData;